#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Created on 2011-6-15

@author: drowning
'''

from jiaju.model import Privilege

def get_privilege_list(user_id , page_id):
    infos = []
    if user_id and page_id:
        infos = Privilege.load(user_id=user_id, page_id=page_id)
        return infos
    else:
        raise "uid is 0"

def meger_privilege(infos):
    privilege = Privilege()
    if infos.get("id") :
        privilege.id = infos.get("id")
    privilege.privilege_value = infos.get("privilege_value")
    privilege.user_id = infos.get("user_id")
    privilege.page_id = infos.get("page_id")
    privilege.persist()
    
if __name__ == '__main__':
    get_privilege_list(1);